﻿using DataStructure;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;

namespace DataStructure.Test
{
    
    
    /// <summary>
    ///This is a test class for GraphsTest and is intended
    ///to contain all GraphsTest Unit Tests
    ///</summary>
    [TestClass()]
    public class GraphsTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Graphs Constructor
        ///</summary>
        [TestMethod()]
        public void GraphsConstructorTest()
        {
            Graphs target = new Graphs();
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        /// <summary>
        ///A test for IsRoute
        ///</summary>
        [TestMethod()]
        public void IsRouteTest()
        {
            List<int> nodes = new List<int>();
            GNode n1 = new GNode(1);
            GNode n2 = new GNode(2);
            GNode n3 = new GNode(3);
            GNode n4 = new GNode(4);
            GNode n5 = new GNode(5);
            GNode n6 = new GNode(6);
            GNode n7 = new GNode(7);

            n1.AddAjacents(n4);
            n1.AddAjacents(n2);

            n2.AddAjacents(n3);

            n3.AddAjacents(n1);
            n3.AddAjacents(n6);


            n4.AddAjacents(n3);
            n4.AddAjacents(n6);

            n5.AddAjacents(n4);

            n6.AddAjacents(n1);
            n6.AddAjacents(n5);
            Graphs g = new Graphs(new List<GNode>() {n1, n2, n3, n4, n5, n6, n7 });
            bool actual;
            actual = Graphs.IsRoute(g, n1, n3);
            Assert.IsTrue(actual);
            Console.WriteLine("has routin");

            actual = Graphs.IsRoute(g, n4, n2);
            Assert.IsTrue(actual);
            Console.WriteLine("has routin");

            actual = Graphs.IsRoute(g, n4, n7);
            Assert.IsFalse(actual);
            Console.WriteLine("has routin");
        }
    }
}
